package com.um.weixin.pay.service;

import com.github.binarywang.wxpay.bean.ecommerce.PartnerTransactionsRequest;
import com.github.binarywang.wxpay.bean.ecommerce.RefundsResult;
import com.github.binarywang.wxpay.bean.ecommerce.TransactionsResult;
import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum;
import com.github.binarywang.wxpay.bean.result.WxPayRefundV3Result;
import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
import com.github.binarywang.wxpay.exception.WxPayException;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

/**
 * 微信支付(服务商版)
 * @author renjunwei
 * 日期 2023/11/8
 * 版权所有 广州优匠科技有限公司
 */
public interface WxPartnerPayService {

    /**
     * JSAPI下单
     * @param outTradeNo
     * @param openId
     * @param amount
     * @param description
     * @param notifyUrl
     * @return
     * @throws WxPayException
     */
    TransactionsResult.JsapiResult createOrderByJsapi(String outTradeNo, String openId, Integer amount,
                                                      String description, String notifyUrl) throws WxPayException;

    /**
     * JSAPI下单
     * @param subMchid
     * @param outTradeNo
     * @param openId
     * @param amount
     * @param description
     * @param notifyUrl
     * @return
     * @throws WxPayException
     */
    TransactionsResult.JsapiResult createOrderByJsapi(String subMchid, String outTradeNo, String openId, Integer amount,
                                                      String description, String notifyUrl) throws WxPayException;

    /**
     * JSAPI下单
     * @param subMchid
     * @param outTradeNo
     * @param openId
     * @param amount
     * @param description
     * @param notifyUrl
     * @return
     * @throws WxPayException
     */
    TransactionsResult.JsapiResult createOrderByJsapi(String subMchid, String outTradeNo, String openId, Integer amount,
                                                             String description, String notifyUrl, boolean isProfitSharing) throws WxPayException;

    /**
     * JSAPI下单
     * @param subMchid
     * @param outTradeNo
     * @param openId
     * @param amount
     * @param description
     * @param notifyUrl
     * @return
     * @throws WxPayException
     */
    TransactionsResult.JsapiResult createOrderByJsapi(String subMchid, String outTradeNo, String openId, Integer amount,
                                                      String description, String notifyUrl, boolean isProfitSharing, Date timeExpire) throws WxPayException;


    /**
     * 申请退款
     * @param subMchId
     * @param outTradeNo
     * @param outRefundNo
     * @param payAmount
     * @param refundAmount
     * @param notifyUrl
     * @return
     */
    WxPayRefundV3Result refundOrder(String subMchId, String outTradeNo, String outRefundNo, Integer payAmount, Integer refundAmount,
                              String reason, String notifyUrl) throws WxPayException;

    /**
     * 申请退款
     * @param subMchId
     * @param outTradeNo
     * @param outRefundNo
     * @param payAmount
     * @param refundAmount
     * @param notifyUrl
     * @return
     */
    WxPayRefundV3Result refundOrder(String subMchId, String outTradeNo, String transactionId, String outRefundNo, Integer payAmount, Integer refundAmount,
                                    String reason, String notifyUrl) throws WxPayException;

}
